//
//  LSLeftTableViewCell.swift
//  niceapp-ios
//
//  Created by sujeking on 2017/8/3.
//  Copyright © 2017年 szw. All rights reserved.
//

import UIKit

class LSLeftTableViewCell: UITableViewCell {
    
    @IBOutlet weak var msgLabel: UILabel!
    @IBOutlet weak var unameLabel: UILabel!
    @IBOutlet weak var iv: UIImageView!
    @IBOutlet weak var msgBgView: UIView!
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        self.setSubViews()
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
    }
    
    func setSubViews() {
        self.msgLabel.preferredMaxLayoutWidth = UIScreen.main.bounds.width - 80
        
        let top: CGFloat  = 15; // 顶端盖高度
        let bottom: CGFloat  = 15 ; // 底端盖高度
        let left: CGFloat  = 15; // 左端盖宽度
        let right: CGFloat  = 15; // 右端盖宽度
        
        var image = #imageLiteral(resourceName: "msg_bg") as UIImage
        let insets = UIEdgeInsetsMake(top, left, bottom, right);
        image = image.resizableImage(withCapInsets: insets, resizingMode: UIImageResizingMode.stretch)
        self.iv.image = image
        
        self.msgBgView.backgroundColor = #colorLiteral(red: 0.1568627451, green: 0.4588235294, blue: 0.9843137255, alpha: 1)
        self.msgBgView.layer.cornerRadius = 5
        self.msgBgView.layer.shadowColor = #colorLiteral(red: 0.1568627451, green: 0.4588235294, blue: 0.9843137255, alpha: 1).cgColor
        self.msgBgView.layer.shadowOffset = CGSize(width: 0, height: 1)
        self.msgBgView.layer.shadowOpacity = 1
        self.msgBgView.layer.shadowRadius = 3
    }
}
